package svc

import (
	"time"
	"goNutpi/internal/config"
	"goNutpi/internal/model"
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"github.com/zeromicro/go-zero/core/stores/cache"
)

type ServiceContext struct {
	Config config.Config
	TopicModel model.TopicModel // 手动代码
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,
		TopicModel: model.NewTopicModel(sqlx.NewMysql(c.DataSource), c.Cache,cache.WithExpiry(time.Hour)), // 手动代码
	}
}
